<?php
/*
	
*/
defined('BY_JYA') or exit('Access Denied');
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';

if($_RQ['op']=='main'){
	/*******main*******/
	//景点
	$params=array('uniacid'=>$_SESSION['uniacid'],'status'=>1);
	if(!empty($_RQ['keyword'])){
		$params['title like']='%'.trim($_RQ['keyword']).'%';
		$return['params']['keyword']=trim($_RQ['keyword']);
	}
	$spots=pdo_getall('jy_tour_spot',$params);
	if($spots){
		foreach($spots as &$item){
			$images=json_decode($item['images'],true);
			$item['thumb']=$images['0'];
			$item['sellnum']=pdo_count('jy_tour_order',array('uniacid'=>$_SESSION['uniacid'],'spot_id'=>$item['id'],'status >'=>'0'));
			$pingjianum=pdo_count('jy_tour_assess',array('uniacid'=>$_SESSION['uniacid'],'spot_id'=>$item['id']));
			$pinjia_good=pdo_count('jy_tour_assess',array('uniacid'=>$_SESSION['uniacid'],'spot_id'=>$item['id'],'star >'=>'3'));
			$item['manyidu']=number_format($pinjia_good/$pingjianum,0)*100;
			$item['pingjianum']=$pingjianum;
		}
	}
	$return['image']=$setting['image'];
	$return['spots']=$spots;
	exi($return);
}